package com.wm.wmim.server.controller;


import com.wm.wmim.common.dto.PageResult;
import com.wm.wmim.server.dto.bo.req.ListChatMessageRecordReqBO;
import com.wm.wmim.server.dto.bo.resp.ChatMessageRecordBO;
import com.wm.wmim.server.dto.vo.req.ListChatMessageRecordReqVO;
import com.wm.wmim.server.dto.vo.resp.ChatMessageRecordVO;
import com.wm.wmim.server.mapstruct.ChatMessageRecordMapstruct;
import com.wm.wmim.server.service.ChatMessageRecordService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 消息记录表(ChatMessageRecord)表控制层
 *
 * @author weiming
 * @since 2024-09-02 22:59:14
 */
@RestController
@RequestMapping("/chatMessageRecord")
public class ChatMessageRecordController {
    /**
     * 服务对象
     */
    @Resource
    private ChatMessageRecordService chatMessageRecordService;

    @Resource
    private ChatMessageRecordMapstruct chatMessageRecordMapstruct;

    @GetMapping("/list")
    public PageResult<ChatMessageRecordVO> listChatMessageRecord(ListChatMessageRecordReqVO reqVO) {
        ListChatMessageRecordReqBO reqBO = chatMessageRecordMapstruct.fromVOToBO(reqVO);
        PageResult<ChatMessageRecordBO> pageResult = chatMessageRecordService.listChatMessageRecord(reqBO);
        return PageResult.fromPageResult(pageResult, chatMessageRecordMapstruct.fromBOToVO(pageResult.getResult()));
    }


}

